public abstract class Dish {
    private String name;
    private String description;
    private double price;
    private int stock;
    private boolean isOnShelf;

    public Dish(String name, String description, double price, int stock, boolean isOnShelf) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.stock = stock;
        this.isOnShelf = isOnShelf;
    }

    public void reduceStock(int quantity) throws InsufficientStockException {
        if (quantity > this.stock) {
            throw new InsufficientStockException("菜品《" + name + "》库存不足，当前库存：" + stock);
        }
        this.stock -= quantity;
    }

    public String getName() { return name; }
    public double getPrice() { return price; }
    public boolean isOnShelf() { return isOnShelf; }
    public int getStock() { return stock; }
}